package cn.springcloud.fix.demo.leecode;

import java.io.*;
import java.util.Random;
import java.util.Scanner;

/**
 * 100万个数据前100大的数据
 */
public class Test13 {

    public static void main(String[] args) throws Exception {
        for (int i = 7; i <= 12; i++) {
            double money = getMouthMoney(25100, 1826, 2738.7, 1500, i);
            System.out.println(money);
        }
        System.out.println("--------");
        System.out.println(lastMoney);
    }

    /**
     * @param salary 工资
     * @param fund  公积金
     * security  社保
     * <p>
     * otherMoney 专项扣除
     * 几个月的工资
     */
    private static double lastMoney = 6015;

    public static double getMouthMoney(double salary, double gongJiJin, double shebao, double otherMoney, int mounth) {
        double money = (salary - gongJiJin - shebao - otherMoney - 5000) * mounth;
        double jumpMoney = 0;
        if (money > 0 && money <= 36000) {
            jumpMoney = money * 0.03;
        } else if (money > 36000 && money <= 144000) {
            jumpMoney = money * 0.1 - 2520;
        } else if (money > 144000 && money <= 300000) {
            jumpMoney = money * 0.2 - 16920;
        } else if (money > 300000 && money <= 420000) {
            jumpMoney = money * 0.25 - 31920;
        } else if (money > 420000 && money <= 660000) {
            jumpMoney = money * 0.3 - 52920;
        } else if (money > 660000 && money <= 960000) {
            jumpMoney = money * 0.35 - 85920;
        } else if (money > 960000) {
            jumpMoney = money * 0.45 - 181920;
        }
        jumpMoney = jumpMoney - lastMoney;
//        System.out.println("税：" + jumpMoney);
        double mouthMoney = salary - gongJiJin - shebao - jumpMoney;
        lastMoney = lastMoney + jumpMoney;
        return mouthMoney;
    }
}
